import type { OptionGroupDto, OptionGroupType, SelectOptionDto, SelectOptionType } from '@/types';
import request from '@/utils/request';

// ----------------组别信息-------------------

/**
 * 查询面试组别
 * @param params 面试组别信息
 * @returns 
 */
export const queryOptionGroup = async (params?: OptionGroupDto) => {
    const res = await request.post('/common/queryOptionGroup',{
        ...params
    });
    return res.data;
}

/**
 * 新增组别信息
 * @param params  面试组别信息
 * @returns 
 */
export const addOptionGroup = async (params: OptionGroupType) => {
    const res = await request.post('/common/addOptionGroup',{
        ...params
    });
    return res.data;
}

/**
 * 修改组别信息
 * @param params  面试组别信息
 * @returns 
 */
export const updateOptionGroup = async (params: OptionGroupType) => {
    const res = await request.post('/common/updateOptionGroup',{
        ...params
    });
    return res.data;
}

/**
 * 删除组别信息
 * @param params  面试组别信息
 * @returns 
 */
export const deleteOptionGroup = async (params: string[]) => {
    const res = await request.post('/common/deleteOptionGroup',params);
    return res.data;
}

// ----------------字典信息-------------------

/**
 * 获取面试选项
 * @param optionGroupKeys 选项组别Key
 * @returns 
 */
export const getInterviewOptions = (optionGroupKeys: string[]) => {
    const res = request.post('/common/getSelectOptions',optionGroupKeys);
    return res;
}

/**
 * 查询字典信息
 * @param params  字典信息
 * @returns 
 */
export const querySelectOption = async (params: SelectOptionDto) => {
    const res = await request.post('/common/querySelectOption',{
        ...params
    });
    return res.data;
}

/**
 * 新增组别信息
 * @param params  面试组别信息
 * @returns 
 */
export const addSelectOption = async (params: SelectOptionType) => {
    const res = await request.post('/common/addSelectOption',{
        ...params
    });
    return res.data;
}

/**
 * 修改组别信息
 * @param params  面试组别信息
 * @returns 
 */
export const updateSelectOption = async (params: SelectOptionType) => {
    const res = await request.post('/common/updateSelectOption',{
        ...params
    });
    return res.data;
}

/**
 * 删除组别信息
 * @param params  面试组别信息
 * @returns 
 */
export const deleteSelectOption = async (params: string[]) => {
    const res = await request.post('/common/deleteSelectOption',params);
    return res.data;
}